<?php
$redis = new redis();
$redis->connect('127.0.0.1', 6379);
$key = 'zset';
$redis->del($key);
foreach (array('a', 'b', 'c', 'd', 'e', 'f', 'g') as $index => $char) {
    $rs = $redis->zAdd($key, $index, $char);
}

//第二个参数
echo "zIncrBy 第二个参数 使用非数字 报错Redis::zIncrBy() expects parameter 2 to be float, string given ";
//$rs = $redis->zIncrBy($key, 'good', 15);
//$ret = $redis->zIncrBy($key ,$score, $member);
/**
 * 排行榜常用
 * zScore 获取分数 分数都是浮点数的形式存储和读取的
 * zRevRank 获取排名 排名从0 开始 end 结束
 * zrevrange 获取排行榜区间
 * zrevrangebyscore 分数区间的排行榜
 */
$data['zScore'] = $redis->zScore($key, 'f');
$data['zRevRank'] = $redis->zRevRank($key, 'f');
$data['zrevrange(key, start,end, withscore=true)'] = $redis->zrevrange($key, 0, 119, true);
$data['zrevrange(key, start,end, withscore=false)'] = $redis->zrevrange($key, 0, 119, false);
$data['zrangeByScore(key, start,end)'] = $redis->zRangeByScore($key, '-inf', '+inf');
$data['zrangeByScore(key, start,end)'] = $redis->zRangeByScore($key, '-inf', '+inf', ['withscores'=> true, 'limit'=>[0, 6]]);
$data['zRevRangeByScore(key, start,end)'] = $redis->zrevRangeByScore($key, '+inf', '-inf', ['withscores'=> true, 'limit'=>[0, 6]]);
$data["zcount($key, '-inf', '+inf')"] = $redis->zcount($key, '-inf', '+inf');
$data["zCard"] = $redis->zCard($key);
var_export($data);



